package root.electronclass.electronclass.grade.member

import android.os.Bundle
import android.view.View
import root.electronclass.electronclass.common.base.ViewBindingFragment
import root.electronclass.electronclass.R
import root.electronclass.electronclass.databinding.FragmentClassMemberDetailBinding
import root.electronclass.electronclass.ext.showAvatar
import root.electronclass.electronclass.grade.model.Person

/**
 * 班级优秀生
 * @author Lokiy
 * @date 2023/2/5 13:19
 */
class ClassMemberDetailFragment : ViewBindingFragment<FragmentClassMemberDetailBinding>() {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val item: Person = arguments?.getParcelable("_DATA") ?: return
        binding.itemName.text = item.name
        binding.itemTag.text = item.title.takeIf { it != "任课老师" } ?: item.tag
        binding.itemNo.text = getString(R.string.class_teacher_no, item.no)
        binding.itemSlogan.text = item.slogan
        binding.itemDesc.text = item.introduce
        binding.itemAvatar.showAvatar(item.avatar)
    }
}
